package com.niu1078.joe.app;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

/**
 * author :ywq .
 * time: 2017/12/19:14:59.
 * desc :app管理者
 * action:
 */

public class AppManager {

    /**
     * 获取版本号
     * @return
     */
    public  static  final int  getVersionCode (){

        PackageManager packageManager = Joe.getApplicationContext().getPackageManager();
        try {
            PackageInfo packageInfo = packageManager.getPackageInfo(Joe.getApplicationContext().getPackageName(), 0);
             return packageInfo.versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
            return 0;
        }

    }
}
